package com.godtree.service.impl;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.godtree.dao.RankDataMapper;
import com.godtree.model.RankData;
import com.godtree.service.IRankDataService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.Collection;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 排名数据 服务实现类
 * </p>
 *
 * @author lisicheng
 * @since 2022-07-18
 */
@Service
public class RankDataServiceImpl extends ServiceImpl<RankDataMapper, RankData> implements
    IRankDataService {

  @Override
  public void updateDefaultRankScore(String ranksId) {
    if (StrUtil.isBlank(ranksId)) {
      return;
    }
    baseMapper.updateDefaultRankScore(ranksId);
  }

  @Override
  public int batchSaveOrUpdate(Collection<RankData> rankDataList) {
    if (CollUtil.isEmpty(rankDataList)) {
      return 0;
    }
    return baseMapper.saveOrUpdateBatch(rankDataList);
  }
}
